package com.nerve.secondhandcar.interceptor;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.nerve.secondhandcar.domain.Brand;
import com.nerve.secondhandcar.service.BrandService;

/**
 * @project: secondHandCarPlatform
 * @file: BrandSelectInterceptor.java
 * @package: com.nerve.secondhandcar.interceptor
 * @description:
 *	为需要用到品牌选择器的Controller注入品牌数据
 *	
 * @author: 集成显卡	1053214511@qq.com
				IBM GDC, zengxm@cn.ibm.com
 * @date&time: 2014-10-20
 * @change log:
 */
@Service
public class BrandSelectInterceptor extends HandlerInterceptorAdapter {
	
	@Autowired
	private BrandService service;
	
	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, 
			Object handler, ModelAndView modelAndView) throws Exception {
		//为试图注入品牌数据
		List<Brand> brandList = service.findForSelect();
		modelAndView.addObject("brandList", brandList);
	}
}